#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int x;
	char c;
	cin >> x >> c;
	int y;
	if (x > 1000)
	{
		y = ceil((x - 1000) / 500.0);
	}
	else
	{
		y = 0;
	}
	if (c == 'y')
	{
		cout << 13 + y * 4;
	}
	else
	{
		cout << 8 + y * 4;
	}
	return 0;
}
/*
int a,ans=8;char s;
int main()
{
	cin>>a>>s;
	if(a>1000)
	{
		a=a-1000;
		ans=ans+(a/500)*4;
		if(a%500!=0)
			ans=ans+4;
	}
	if(s=='y')
		ans=ans+5;
	cout<<ans;
	return 0;
}
*/